package com.miplus.ccrm.report.controller;

import com.miplus.ccrm.common.CmdResVo;
import com.miplus.ccrm.common.PageData;
import com.miplus.ccrm.common.R;
import com.miplus.ccrm.report.controller.vo.rep.DistCaseNumReqVo;
import com.miplus.ccrm.report.controller.vo.rep.DistCaseNumResVo;
import com.miplus.ccrm.report.controller.vo.rep.RecyAgDayReqVo;
import com.miplus.ccrm.report.controller.vo.rep.RecyAgDayResVo;
import com.miplus.ccrm.report.security.JCommonData;
import com.miplus.ccrm.report.service.cti.ReportCallHistService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 3-4.业务报表数据接口
 */
@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping("/buss")
public class BussController {
    @Resource
    private JCommonData jCommonData;

    @Resource
    private ReportCallHistService reportCallHistService;

    /**
     * 回收表现统计报表
     */
    @GetMapping("/recoveryTotal")
    public R<PageData<RecyAgDayResVo>> recoveryTotal(@Validated RecyAgDayReqVo recyAgDayReqVo){
        String usrid= jCommonData.getCurrUsrID();
        return R.SuccessPage(reportCallHistService.recoveryTotal(usrid,recyAgDayReqVo));
    }

    /**
     * 回收表现统计报表导出
     */
    @PostMapping("/expRecoveryTotal")
    public R<CmdResVo> expRecoveryTotal(@RequestBody @Validated RecyAgDayReqVo recyAgDayReqVo, HttpServletResponse response){
        String usrid= jCommonData.getCurrUsrID();
        return R.Success(reportCallHistService.expRecoveryTotal(usrid,recyAgDayReqVo,response));
    }

    /**
     * 分配案件数量统计报表
     */
    @GetMapping("/assignTotal")
    public R<PageData<DistCaseNumResVo>> assignTotal(@Validated DistCaseNumReqVo distCaseNumReqVo){
        String usrid= jCommonData.getCurrUsrID();
        return R.SuccessPage(reportCallHistService.assignTotal(usrid,distCaseNumReqVo));
    }

    /**
     * 分配案件数量统计报表导出
     */
    @PostMapping("/expAssignTotal")
    public R<CmdResVo> expAssignTotal(@RequestBody @Validated DistCaseNumReqVo distCaseNumReqVo, HttpServletResponse response){
        String usrid= jCommonData.getCurrUsrID();
        return R.Success(reportCallHistService.expAssignTotal(usrid,distCaseNumReqVo,response));
    }
}
